<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vuejs测试</title>
    <script src="vue/vue.js"></script>
    <style type="text/css">
        div{
            width: 100px;
            height: 100px;
            color: #e3ff4c;
        }
        .red{
            background-color: red;
        }
        .blue{
            background-color: blue;
        }
    </style>
</head>
<body>
<div id="app">
    <button v-on:click="color='red'">红色</button>
    <button v-on:click="color='blue'">红色</button>
    <div v-bind:class="color">
        点击按钮改变颜色
    </div>
    <hr>
    <br>
    <button v-on:click="bool=!bool">点我改变颜色</button>
    <div :class="{red:bool, blue:!bool}">
        点击改变颜色
    </div>
</div>
<script type="text/javascript">
    let app = new Vue({
        el: "#app",
        data: {
            bool:true,
            color:"red",
        }
    });
</script>
</body>
</html>